﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RedDragon.Common.Domain.InventoryAllocate;
using RedDragon.RBAC.API.Application.Common.Inventoryscheduling;
using T.Common.Domain.Common;

namespace RedDragon.RBAC.API.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class InventoryController : ControllerBase
    {
        public readonly IMediator mediator;

        public InventoryController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 库存调拨新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>

        [HttpPost("InventoryAdd")]
        public async Task<Result> Handle(InventoryschedulingCreateCommon request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 库存调拨列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("InventorySearch")]
        public async Task<Result> Handle([FromQuery] InventorySearchCommon request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 库存调拨新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("InventoryDetailAdd")]
        public async Task<Result> Handle(InventoryDetailCreateCommon request)
        {
            return await mediator.Send(request);
        }


        /// <summary>
        /// 来源仓库地址反填
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("SourWareHouseFull")]
        public async Task<Result> Handle([FromQuery]SourWareHouseFullCommon request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 目标仓库地址反填
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("TargetWareHouseFull")]

        public async Task<Result> Handle([FromQuery]TargetWareHouseFullCommon request)
        {

            return await mediator.Send(request);
        }

        /// <summary>
        /// 仓库调度明细表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("InventoryDetail")]

        public async Task<Result> Handle([FromQuery]InventoryDetailSearchCommon request)
        {
            return await mediator.Send(request);
        }


        /// <summary>
        /// 物料选择（反填）
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("MaterailFull")]

        public async Task<Result> Handle([FromQuery]MaterialsSearchCommon request)
        {
            return await mediator.Send(request);
        }
    }
}
